package com.example.softtest1;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.CsvFileSource;

public class TriangleTest {
    @Test
    @DisplayName("输入错误")
    void parameters_error_test() {
        Triangle triangle = new Triangle();
        String type = triangle.classify(0, 4, 5);
        Assertions.assertEquals("输入错误", type);
    }
    @Test
    @DisplayName("不等边三角形")
    void scalene_test() {
        Triangle triangle = new Triangle();
        String type = triangle.classify(3, 4, 6);
        Assertions.assertEquals("不等边三角形", type);
    }

    @Test
    @DisplayName("等边三角形")
    void scalene_test1() {
        Triangle triangle = new Triangle();
        String type = triangle.classify(4, 4, 4);
        Assertions.assertEquals("等边三角形", type);
    }

    @Test
    @DisplayName("不等边三角形")
    void scalene_test2() {
        Triangle triangle = new Triangle();
        String type = triangle.classify(3, 4, 5);
        Assertions.assertEquals("不等边三角形", type);
    }

    @Test
    @DisplayName("等边三角形")
    void scalene_test3() {
        Triangle triangle = new Triangle();
        String type = triangle.classify(3, 3, 3);
        Assertions.assertEquals("等边三角形", type);
    }

    @Test
    @DisplayName("等腰三角形")
    void scalene_test4() {
        Triangle triangle = new Triangle();
        String type = triangle.classify(4, 4, 7);
        Assertions.assertEquals("等腰三角形", type);
    }

    @Test
    @DisplayName("输入错误")
    void scalene_test5() {
        Triangle triangle = new Triangle();
        String type = triangle.classify(-1, 4, 7);
        Assertions.assertEquals("输入错误", type);
    }

    @Test
    @DisplayName("非三角形")
    void scalene_test6() {
        Triangle triangle = new Triangle();
        String type = triangle.classify(1, 4, 7);
        Assertions.assertEquals("非三角形", type);
    }

    @Test
    @DisplayName("等腰三角形")
    void scalene_test7() {
        Triangle triangle = new Triangle();
        String type = triangle.classify(2, 2, 3);
        Assertions.assertEquals("等腰三角形", type);
    }

    @Test
    @DisplayName("等边三角形")
    void scalene_test8() {
        Triangle triangle = new Triangle();
        String type = triangle.classify(2, 2, 2);
        Assertions.assertEquals("等边三角形", type);
    }

    @ParameterizedTest
    @CsvFileSource(resources = "/test1.csv")
    void test_csv_file_source(int a, int b, int c, String expected) {
        Triangle triangle = new Triangle();
        Assertions.assertEquals(expected, triangle.classify(a, b, c));
    }
    @ParameterizedTest
    @CsvFileSource(resources = "/test2.csv")
    void test_csv_file_source2(int a, int b, int c, String expected) {
        Triangle triangle = new Triangle();
        Assertions.assertEquals(expected, triangle.classify(a, b, c));
    }
    @ParameterizedTest
    @CsvFileSource(resources = "/test3.csv")
    void test_csv_file_source3(int a, int b, int c, String expected) {
        Triangle triangle = new Triangle();
        Assertions.assertEquals(expected, triangle.classify(a, b, c));
    }
    @ParameterizedTest
    @CsvFileSource(resources = "/test4.csv")
    void test_csv_file_source4(int a, int b, int c, String expected) {
        Triangle triangle = new Triangle();
        Assertions.assertEquals(expected, triangle.classify(a, b, c));
    }
}

